
package com.shop.cloud.controller.test;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Vector;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.shop.cloud.filter.CurrentUserId;
import com.shop.cloud.filter.IgnoreAuth;
import com.shop.cloud.model.request.LoginRequest;
import com.shop.cloud.model.response.LoginResponse;
import com.shop.cloud.model.response.ObjectDataResponse;

/**
 * 测试
 */
@Controller
@RequestMapping("test")
@Api(value="测试")
public class DemoController {
    
    @IgnoreAuth
    @ApiOperation(value = "测试接口", notes = "测试接口")
	@RequestMapping(value = "test", method = RequestMethod.POST)
	@ResponseBody
	public ObjectDataResponse<LoginResponse> test(@ApiParam(hidden=true,name="登录用户ID")@CurrentUserId Long userId,@RequestBody LoginRequest loginRequest)  {
		System.out.println("--------------------test------------------------userId-["+userId+"]");
		loginRequest.setUsername(loginRequest.getUsername()+"----login");
		LoginResponse loginResponse=new LoginResponse();
		//loginResponse.setCode(20000);
		return new ObjectDataResponse<LoginResponse>(loginResponse);
	}
    
    @ApiOperation(value = "测试接口", notes = "测试接口")
   	@RequestMapping(value = "test02", method = RequestMethod.POST)
   	@ResponseBody
   	public ObjectDataResponse<Boolean> test02(@ApiParam(hidden=true,name="登录用户ID")@CurrentUserId Long userId,@RequestBody LoginRequest loginRequest)  {
   		System.out.println("--------------------test------------------------userId-["+userId+"]");
   		loginRequest.setUsername(loginRequest.getUsername()+"----login");
   		return new ObjectDataResponse<Boolean>(true);
   	}
    
    @ApiOperation(value = "测试接口", notes = "测试接口")
   	@RequestMapping(value = "test03", method = RequestMethod.GET)
   	@ResponseBody
   	public ObjectDataResponse<Boolean> test03(@ApiParam(hidden=true,name="登录用户ID")@CurrentUserId Long userId)  {
   		System.out.println("--------------------test------------------------userId-["+userId+"]");
   		return new ObjectDataResponse<Boolean>(true);
   	}
    
    public static void main(String[] args) {
    	Vector v=new Vector<String>();
    	v.add("ok");
    	v.add("ok2");
    	
    	for (int i = 0; i < v.size(); i++) {
    		
    		System.out.println(v.get(i));
			
		}
    	
    	List list=Collections.synchronizedList(new ArrayList<String>());
    	list.add("123");
    	list.add("234");
    	for (int i = 0; i < list.size(); i++) {
			System.out.println(list.get(i));
		}
    	
	}

}
